/**
 * Created by python on 19-2-27.
 */

var HOST = "http://127.0.0.1:8000";



//字符串转日期类型 str2date
// 日期类型得到年月日 date2ymd
// 日期类型得到时分秒 date2hms
//日期类型得到周几 date2week
//日期类型得到时分 date2hm
//

Vue.filter('str2date',function(value){
    return  new Date(value)
});
Vue.filter('date2ymd',function(value,row){
    return  value.getFullYear() + "-" + (value.getMonth() +1) +"-" +value.getDate()
});
Vue.filter('date2hms',function(value){
    return  value.getHours() + ":" +value.getMinutes() + ":" +value.getSeconds()
});

const WEEK = ["周日","周一","周二","周三","周四","周五","周六"];
Vue.filter('date2week',function(value){
    return WEEK[value.getDay()]
});
Vue.filter('date2hm',function(value){
    return  value.getHours() + ":" +value.getMinutes()
});


// 获取url路径参数
function  get_query_string(key,defval) {
    var reg = new RegExp('(^|&)' + key + '=([^&]*)(&|$)', 'i');
    var r = window.location.search.substr(1).match(reg);
    if (r != null) {
        return decodeURI(r[2]);
    }
    return defval
}
